/*
 * @Description: dqrAPI
 */
import { get, post } from '@/utils/http';
import { IDqrItem, IDqrParam, IDqrResult } from './model/modelDqr';
import { BasicPagingListResult } from '@/apis/basicModel';

enum Api {
  // dqr数据列表
  GET_DQR_LIST = '/footprint/model/dqr/pageDqrData',
  // 识别最相关
  RECOGNIZE = '/footprint/model/dqr/recognizeRelevance',
  // dqr计算
  CALC_DQR = '/footprint/model/dqr/calcDqr',
  // dqr评分
  SCORE_DQR = '/footprint/model/dqr/scoreDqr',
  // 模型数据质量评价结果查询
  GET_DQR_RESULT = '/footprint/model/dqr/getResult',
  // 获取节点详情
  GET_NODE_INFO = '/footprint/modelProcessData/getDqrNodeInfo',
  // 获取因子详情
  GET_FACTOR_INFO = '/footprint/factor/getByFactorNo'
}

// dqr数据列表
export const getDqrList = (params: IDqrParam): Promise<BasicPagingListResult<IDqrItem>> =>
  get(Api.GET_DQR_LIST, params);
export const recognizeRelevance = (modelNo: string): Promise<void> =>
  post(Api.RECOGNIZE, { modelNo });
export const calcDqr = (modelNo: string): Promise<number> => post(Api.CALC_DQR, { modelNo });
export const scoreDqr = (params: any): Promise<void> => post(Api.SCORE_DQR, params);
export const getNodeInfo = (nodeNo: string): Promise<any> => get(Api.GET_NODE_INFO, { nodeNo });
export const getFactorInfo = (factorNo: string): Promise<any> =>
  get(Api.GET_FACTOR_INFO, { factorNo });

export const getDqrResult = (modelNo: string): Promise<IDqrResult> =>
  get(Api.GET_DQR_RESULT, { modelNo });
